package com.p2p.front.util;

import java.io.IOException;

import com.itextpdf.text.BaseColor;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.Font;
import com.itextpdf.text.FontProvider;
import com.itextpdf.text.pdf.BaseFont;

public class PdfCnFontProvider implements FontProvider {

	@Override
	public boolean isRegistered(String fontname) {
		return true;
	}

	@Override
	public Font getFont(String fontname, String encoding, boolean embedded,
			float size, int style, BaseColor color) {
		BaseFont bfChinese;
		try {
			bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H",
					BaseFont.NOT_EMBEDDED);
			Font keyfont = new Font(bfChinese, 16);
			return keyfont;
		} catch (DocumentException | IOException e) {
			e.printStackTrace();
		}
		return null;
	}

}